<div data-role="page">

	<div data-role="header" data-position="fixed" data-tap-toggle="false">
    <h1>Hỏi đáp</h1>
    <a href="" data-rel="back" class="ui-btn-left" data-icon="home" data-direction="reverse" <%= "data-ajax='false'" if is_bb6 %>>
      Quay lại
    </a>
    <% if $user["role"] == "student" && @data["question"]["status"] != "accepted" %>
    <a href="<%= url_for(:action => :accept, :controller => :Question, :query => {:question_id => @data["question"]["id"], :teacher_id => @teacher_id}) %>" class="ui-btn-right">
      Chấp nhận
    </a>
    <% end %>
  </div>

  <div data-role="content">
    <div class="triangle-right left">

      <%= @data["question"]["title"] %>
    </div>
    <% if @data["qa_details"].nil? == false %>
      <% @data["qa_details"].each do |qadetail| %>
        <% if $user["id"] == qadetail["user_id"] && $user["role"]=="student" %>
          <div class="triangle-right left">
        <% else %>
          <div class="triangle-right right">
        <% end %>
          <%= qadetail["content"] %>
      </div>
      <% end %>
    <% end %>


    <% if $image %>
    <div class="triangle-right left">

      <img id="new-picture" src="<%= Rho::RhoApplication::get_blob_path($image.image_uri) %>" width="200" />
      
    </div>

    <% end %>
    <div data-role="footer" data-position="fixed" data-tap-toggle="false">
      <form method="post" action="/app/QADetail/submit_qa_detail">
        <% if $user['role'] == 'teacher' %>
        <input name="user_id" type="hidden" value="<%= $user['id'] %>" />
        <input type="hidden" name="other_user_id" value="<%= @data['question']['student_id'] %>" />
        <% else %>
        <input name="other_user_id" type="hidden" value="<%= @teacher_id %>" />
        <input type="hidden" name="user_id" value="<%= $user['id'] %>" />
        <% end %>
        <input type="hidden" name="question_id" value="<%= @data['question']['id'] %>" />
      <% if @data["question"]["status"] == "accepted" %>
      Câu hỏi này đã được đóng. <br />
      <% else %>

      <div class="textareaDiv">

        <textarea data-inline="true" name="content" data-theme="b" placeholder="Nhập nội dung"></textarea>
      </div>
      <div class="my-format">
      <input data-inline="true" type="submit" value="Gửi phản hồi" />
      </div>

      
    </form>
    </div>

    <% end %>
  </div>
</div>
